Add an ignore_enter flag and use it as in the menu code to avoid the
authorMatthias Clasen <maclas@gmx.de>
Sun, 6 Jun 2004 03:17:45 +0000 (03:17 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sun, 6 Jun 2004 03:17:45 +0000 (03:17 +0000)
Sat Jun  5 23:07:30 2004  Matthias Clasen  <maclas@gmx.de>

* gtk/gtkentrycompletion.c: (gtk_entry_completion_init),
(gtk_entry_completion_list_enter_notify),
(gtk_entry_completion_list_motion_notify),
(_gtk_entry_completion_popup), (_gtk_entry_completion_popdown):
* gtk/gtkentryprivate.h: Add an ignore_enter flag and
use it as in the menu code to avoid the initial selection if
the window pops up under the pointer.  (Anders Carlsson)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkentrycompletion.c
gtk/gtkentryprivate.h

index 4ffac1967ded498a123840a5fb0990c54c87735d..0bd49283a7e44f653b5b0ec747600f58fb220ee5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+Sat Jun  5 23:07:30 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c: (gtk_entry_completion_init),
+       (gtk_entry_completion_list_enter_notify),
+       (gtk_entry_completion_list_motion_notify),
+       (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown):
+       * gtk/gtkentryprivate.h: Add an ignore_enter flag and
+       use it as in the menu code to avoid the initial selection if
+       the window pops up under the pointer.  (Anders Carlsson)
+
 Sat Jun  5 20:05:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testmerge.c: Add a checkbox to queue an
index 4ffac1967ded498a123840a5fb0990c54c87735d..0bd49283a7e44f653b5b0ec747600f58fb220ee5 100644 (file)
@@ -1,3 +1,13 @@
+Sat Jun  5 23:07:30 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c: (gtk_entry_completion_init),
+       (gtk_entry_completion_list_enter_notify),
+       (gtk_entry_completion_list_motion_notify),
+       (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown):
+       * gtk/gtkentryprivate.h: Add an ignore_enter flag and
+       use it as in the menu code to avoid the initial selection if
+       the window pops up under the pointer.  (Anders Carlsson)
+
 Sat Jun  5 20:05:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testmerge.c: Add a checkbox to queue an
index 4ffac1967ded498a123840a5fb0990c54c87735d..0bd49283a7e44f653b5b0ec747600f58fb220ee5 100644 (file)
@@ -1,3 +1,13 @@
+Sat Jun  5 23:07:30 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c: (gtk_entry_completion_init),
+       (gtk_entry_completion_list_enter_notify),
+       (gtk_entry_completion_list_motion_notify),
+       (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown):
+       * gtk/gtkentryprivate.h: Add an ignore_enter flag and
+       use it as in the menu code to avoid the initial selection if
+       the window pops up under the pointer.  (Anders Carlsson)
+
 Sat Jun  5 20:05:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testmerge.c: Add a checkbox to queue an
index 4ffac1967ded498a123840a5fb0990c54c87735d..0bd49283a7e44f653b5b0ec747600f58fb220ee5 100644 (file)
@@ -1,3 +1,13 @@
+Sat Jun  5 23:07:30 2004  Matthias Clasen  <maclas@gmx.de>
+
+       * gtk/gtkentrycompletion.c: (gtk_entry_completion_init),
+       (gtk_entry_completion_list_enter_notify),
+       (gtk_entry_completion_list_motion_notify),
+       (_gtk_entry_completion_popup), (_gtk_entry_completion_popdown):
+       * gtk/gtkentryprivate.h: Add an ignore_enter flag and
+       use it as in the menu code to avoid the initial selection if
+       the window pops up under the pointer.  (Anders Carlsson)
+
 Sat Jun  5 20:05:39 2004  Soeren Sandmann  <sandmann@daimi.au.dk>
 
        * tests/testmerge.c: Add a checkbox to queue an
index 4747cb3a8115287ee187beb2b39a5339cefbfdea..3d6f15a88957d8f9c81444a91a2197e72ad5cf4d 100644 (file)
@@ -109,7 +109,12 @@ static gboolean gtk_entry_completion_action_button_press (GtkWidget
                                                           gpointer                 user_data);
 static void     gtk_entry_completion_selection_changed   (GtkTreeSelection        *selection,
                                                           gpointer                 data);
-
+static gboolean        gtk_entry_completion_list_enter_notify   (GtkWidget               *widget,
+                                                         GdkEventCrossing        *event,
+                                                         gpointer                 data);
+static gboolean gtk_entry_completion_list_motion_notify         (GtkWidget               *widget,
+                                                         GdkEventMotion          *event,
+                                                         gpointer                 data);
 static void     gtk_entry_completion_insert_action       (GtkEntryCompletion      *completion,
                                                           gint                     index,
                                                           const gchar             *string,
@@ -292,6 +297,12 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
   g_signal_connect (priv->tree_view, "button_press_event",
                     G_CALLBACK (gtk_entry_completion_list_button_press),
                     completion);
+  g_signal_connect (priv->tree_view, "enter_notify_event",
+                   G_CALLBACK (gtk_entry_completion_list_enter_notify),
+                   completion);
+  g_signal_connect (priv->tree_view, "motion_notify_event",
+                   G_CALLBACK (gtk_entry_completion_list_motion_notify),
+                   completion);
   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->tree_view), FALSE);
   gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (priv->tree_view), TRUE);
 
@@ -324,6 +335,12 @@ gtk_entry_completion_init (GtkEntryCompletion *completion)
   g_signal_connect (priv->action_view, "button_press_event",
                     G_CALLBACK (gtk_entry_completion_action_button_press),
                     completion);
+  g_signal_connect (priv->action_view, "enter_notify_event",
+                   G_CALLBACK (gtk_entry_completion_list_enter_notify),
+                   completion);
+  g_signal_connect (priv->action_view, "motion_notify_event",
+                   G_CALLBACK (gtk_entry_completion_list_motion_notify),
+                   completion);
   gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (priv->action_view), FALSE);
   gtk_tree_view_set_hover_selection (GTK_TREE_VIEW (priv->action_view), TRUE);
 
@@ -1127,6 +1144,29 @@ get_borders (GtkEntry *entry,
     }
 }
 
+static gboolean
+gtk_entry_completion_list_enter_notify (GtkWidget        *widget,
+                                       GdkEventCrossing *event,
+                                       gpointer          data)
+{
+  GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data);
+  
+  return completion->priv->ignore_enter;
+}
+
+static gboolean
+gtk_entry_completion_list_motion_notify (GtkWidget      *widget,
+                                        GdkEventMotion *event,
+                                        gpointer        data)
+{
+  GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (data);
+
+  completion->priv->ignore_enter = FALSE; 
+  
+  return FALSE;
+}
+
+
 /* some nasty size requisition */
 gboolean
 _gtk_entry_completion_resize_popup (GtkEntryCompletion *completion)
@@ -1227,8 +1267,8 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
   if (GTK_WIDGET_MAPPED (completion->priv->popup_window))
     return;
 
-  completion->priv->may_wrap = TRUE;
-
+  completion->priv->ignore_enter = TRUE;
+    
   column = gtk_tree_view_get_column (GTK_TREE_VIEW (completion->priv->action_view), 0);
   renderers = gtk_tree_view_column_get_cell_renderers (column);
   gtk_widget_ensure_style (completion->priv->tree_view);
@@ -1254,6 +1294,8 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
 void
 _gtk_entry_completion_popdown (GtkEntryCompletion *completion)
 {
+  completion->priv->ignore_enter = FALSE;
+  
   gdk_pointer_ungrab (GDK_CURRENT_TIME);
   gtk_grab_remove (completion->priv->popup_window);
 
index 7816c8784e2311a2dce0bfd9b7250fdfba61f2a9..aed129e027d2f8cb87206bfcbe50a743f2c0886c 100644 (file)
@@ -58,7 +58,7 @@ struct _GtkEntryCompletionPrivate
   gulong key_press_id;
   gulong key_release_id;
 
-  gboolean may_wrap;
+  gboolean ignore_enter;
 };
 
 gboolean            _gtk_entry_completion_resize_popup           (GtkEntryCompletion          *completion);